package javabasics.designpattern.decorator;

/**
 *
 * @Author suxiaoxiao
 * @Date 2019/6/1 17:12
 * @Version 1.0
 */
public class PacketHTTPHeaderCreator extends PacketDecorator {

    public PacketHTTPHeaderCreator(IPacketCreator c) {
        super(c);
    }

    /**
     * 对给定数据加上HTTP头信息
     * @return
     */
    @Override
    public String handleContent() {
        StringBuffer sb = new StringBuffer();
        sb.append("Cache-Control:no-cache\n");
        sb.append("Date:Mon,31Dec201204:25:57GMT\n");
        sb.append(component.handleContent());
        return sb.toString();
    }
}
